import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "DBshopST014_删除商品分类测试 "

#1.打开后台 登录
firfox=openBrowser(urlAdmin)
DBshopLoginAdmin(firfox)
#2.点击商品管理 管理分类 商品分类
time.sleep(1)
DBshopEnterMenu3(firfox,"商品管理","管理分类","商品分类")
# 2.点击分类名称为“商品分类测试”后方的删除分类"链接
firfox.find_element_by_xpath('//td[contains(.,"%s")]/following-sibling::td[4]/a[3]'%goodsClassName).click()
time.sleep(1)
firfox.switch_to.alert.accept()
time.sleep(1)
#断言
try:
    firfox.find_element_by_xpath('//td[contains(.,"%s")]'%goodsClassName).is_displayed()
    writeLog("%s 测试失败" % testCase)
    getPhoto(firfox)
except:
    writeLog("%s 测试成功" % testCase)

firfox.quit()